Skip to content

Modify Samples to Call Function App and Web App Samples via Default Hostname#76

Open
paolosalvatori wants to merge 9 commits intomainfrom
fix-docs
Open

Modify Samples to Call Function App and Web App Samples via Default Hostname#76
paolosalvatori wants to merge 9 commits intomainfrom
fix-docs

Conversation

@paolosalvatori
Copy link
Copy Markdown
Contributor

Motivation

This pull request changes the way web apps and function apps are invoked in the call-web-app.url scripts.

Changes

This pull request introduces and show how to invoke web apps and function app with a HTTP trigger function via the default hostname of the app. The following code is valid for a web app:

        # Get the the default host name of the web app
	echo "Getting the default host name of the web app [$web_app_name]..."
	app_host_name=$(az webapp show \
		--name "$web_app_name" \
		--resource-group "$resource_group_name" \
		--query 'defaultHostName' \
		--output tsv)
		
        if [ -n "$app_host_name" ]; then
		# Call the web app via the default hostname
		echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..."
		curl -s "http://$app_host_name/" 1> /dev/null

		if [ $? == 0 ]; then
			echo "Web app call via default hostname [$app_host_name] succeeded."
		else
			echo "Web app call via default hostname [$app_host_name] failed."
		fi
	else
		echo "Failed to retrieve web app hostname"
	fi

Tests

Changes were validated locally running updated scripts.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants